local skel = fk.CreateSkill {
  name = "emo__xiushen",
  tags = {Skill.Compulsory},
}

Fk:loadTranslationTable{
  ["emo__xiushen"] = "修身",
  [":emo__xiushen"] = "锁定技，游戏开始时，你选择一项：1，你计算与其他角色的距离-1；2，增加一点体力上限。",

  ["emo__xiushen1"] = "与其他角色距离-1",
  ["emo__xiushen2"] = "增加一点体力上限",
  ["@emo__xiushen"] = "修身",

  ["$emo__xiushen1"] = "善身循礼，天自怜之。",
  ["$emo__xiushen2"] = "此间乱，不忍以身入淤泥。",
  ["$emo__xiushen3"] = "颜娴人静，不为俗世所扰。",
  ["$emo__xiushen4"] = "世皆纷扰，唯我独静。",
}

skel:addEffect(fk.GameStart, {
  mute = true,
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(skel.name)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player:broadcastSkillInvoke(skel.name, math.random(2) + (event == fk.GameStart and 0 or 2))
    room:notifySkillInvoked(player, skel.name)
    if room:askToChoice(player, { choices = {"emo__xiushen1","emo__xiushen2"}, skill_name = skel.name}) == "emo__xiushen1" then
      room:addPlayerMark(player, "@emo__xiushen")
    else
      room:changeMaxHp(player, 1)
    end
  end,
})

skel:addEffect("distance", {
  correct_func = function(self, from, to)
    if from:hasSkill(skel.name) then
      return - from:getMark("@emo__xiushen")
    end
  end,
})

skel:addLoseEffect(function (self, player, is_death)
  player.room:setPlayerMark(player, "@emo__xiushen", 0)
end)

return skel
